<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
  <title>用户管理系统 - 编辑用户</title>
  <style>
    body { font-family: Arial, sans-serif; margin: 0; padding: 20px; }
    .container { width: 90%; max-width: 500px; margin: 0 auto; }
    h1 { color: #333; text-align: center; }
    form { background-color: #f9f9f9; padding: 20px; border-radius: 5px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
    .form-group { margin-bottom: 15px; }
    label { display: block; margin-bottom: 5px; font-weight: bold; }
    input[type="text"], input[type="password"] { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 4px; box-sizing: border-box; }
    .btn {
      display: inline-block; padding: 12px 20px; background-color: #4CAF50; color: white;
      border: none; border-radius: 4px; cursor: pointer; font-size: 16px; margin-right: 10px;
    }
    .btn:hover { background-color: #45a049; }
    .back-btn { margin-top: 20px; text-align: center; }
  </style>
</head>
<body>
<div class="container">
  <h1>用户管理系统 - 编辑用户</h1>
  <div class="back-btn">
    <a href="${pageContext.request.contextPath}/user/list" class="btn">返回用户列表</a>
  </div>

  <form action="${pageContext.request.contextPath}/user/update" method="post">
    <!-- 隐藏字段传递用户ID -->
    <input type="hidden" name="id" value="${user.id}">

    <div class="form-group">
      <label for="username">用户名：</label>
      <input type="text" id="username" name="username" value="${user.username}" required>
    </div>
    <div class="form-group">
      <label for="password">密码：</label>
      <input type="password" id="password" name="password" value="${user.password}" required>
    </div>

    <button type="submit" class="btn">保存修改</button>
    <a href="${pageContext.request.contextPath}/user/list" class="btn">取消</a>
  </form>
</div>
</body>
</html>